#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int halveArray(vector<int>& nums) {
    priority_queue<double> pq;
    double sum = 0;

    for (auto& e : nums)
    {
        pq.push(e);
        sum += e;
    }
    sum /= 2;

    int ret = 0;
    while (sum > 0)
    {
        auto t = pq.top() / 2.0;
        pq.pop();

        ret++;

        sum -= t;
        pq.push(t);
    }

    return ret;
}

int main()
{
    vector<int> arr = { 5,19,8,1 };
    halveArray(arr);
	return 0;
}